package cn.tedu.zhyl.base.config;

import cn.tedu.zhyl.base.properties.MinioProperties;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MinioClientConfig {
    @Autowired
    private MinioProperties minioProperties;

    /**
     * 创建minip客户端
     * @return
     */
    @Bean
    public MinioClient minioClient(){
        MinioClient minioClient =
                MinioClient.builder()
                        .endpoint(minioProperties.getEndPointUrl())
                        .credentials(minioProperties.getAccessKey(), minioProperties.getSecreKey())
                        .build();
        return minioClient;
    }
}
